﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Twitter.Models.Enums;

namespace Twitter.Extensions
{
    public static class TranslatorExtensions
    {
        public static DataCount ToDataCount(this int dataCount)
        {
            return (DataCount)Enum.ToObject(typeof(DataCount), dataCount);
        }

        public static Language ToLanguage(this int language)
        {
            return (Language)Enum.ToObject(typeof(Language), language);
        }

        public static WidgetBehavior ToWidgetBehavior(this int behavior)
        {
            return (WidgetBehavior)Enum.ToObject(typeof(WidgetBehavior), behavior);
        }

        public static string ToLanguageCode(this Language language)
        {
            switch (language)
            {
                case Language.French:
                    return "fr";
                case Language.German:
                    return "de";
                case Language.Spanish:
                    return "es";
                case Language.Japanese:
                    return "ja";
                default:
                    return "";
            }
        }
    }
}